package day8;

import java.util.Scanner;

public interface Shoping {
    void product();
}

abstract class Coffee implements Shoping{ }

class Water implements Shoping{
    @Override
    public void product() {
        System.out.println("开始生产矿泉水！");
    }
}

abstract class Coke implements Shoping{ }

class Milk extends Coffee{
    @Override
    public void product() {
        System.out.println("开始生产加牛奶的咖啡！");
    }
}
class Suger extends Coffee{
    @Override
    public void product() {
        System.out.println("开始生产加糖的咖啡！");
    }
}
class Nothing extends Coffee{
    @Override
    public void product() {
        System.out.println("开始生产普通的咖啡！");
    }
}

class Keko extends Coke{
    @Override
    public void product() {
        System.out.println("开始生产可口可乐！");
    }
}
class Baishi extends Coke{
    @Override
    public void product() {
        System.out.println("开始生产百事可乐！");
    }
}

class TestDrink{
    static Scanner sc=new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("*****欢迎来到饮料商城*****");
        System.out.println("1.咖啡");
        System.out.println("2.矿泉水");
        System.out.println("3.可乐");
        System.out.println("***********************");
        System.out.print("请输入对应的编号：");
        int n=sc.nextInt();
        Shoping sp=null;
        switch (n){
            case 1:
                System.out.print("请输入咖啡的类型（1.加糖，2.加奶，3.什么都不加）：");
                int type=sc.nextInt();
                if (type==1) sp=new Suger();
                if (type==2) sp=new Milk();
                else sp=new Nothing();
                break;
            case 2:
                sp=new Water();
                break;
            case 3:
                System.out.println("请输入可乐的类型（1.可口可乐，2.百事可乐）：");
                type= sc.nextInt();
                if (type==1) sp=new Keko();
                else sp=new Baishi();
                break;
        }
        sp.product();
    }
}

